package de.upb.aquarium;

import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.GLCanvas;

import com.sun.opengl.util.FPSAnimator;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		final Frame frame = new Frame("Aquarium");
		frame.setSize(800,500);
		frame.setLocationRelativeTo(null);

		GLCanvas canvas = new GLCanvas();
		canvas.addGLEventListener(World.getInstance());

		FPSAnimator animator = new FPSAnimator(canvas, 1000);

		frame.add(canvas);
		frame.setVisible(true);
		animator.start();

		canvas.requestFocus();

		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosing(WindowEvent e) {

				frame.setVisible(false);
				super.windowClosing(e);
				System.out.println("Thank you for watching. " +
				"Come back some time later.");
				System.exit(0);
			}
		});
	}

}
